<%-- 
    Document   : deletead
    Created on : Dec 7, 2011, 1:04:36 AM
    Author     : Michael
--%>

<%@page import="java.util.Enumeration"%>
<%@page import="java.sql.Connection"%>
<% if(session.getAttribute("LoggedIn")==null)
       {
    response.sendRedirect("index.html");
    return;
        }

%>
<%
    Enumeration<String> attNames = session.getAttributeNames();
    String adID = "";    
    while(attNames.hasMoreElements())
    {
        if(attNames.nextElement().equalsIgnoreCase("AdID"))
        {
            adID = session.getAttribute("AdID").toString();
            session.removeAttribute("AdID");
        }         
    }
    Connection conn = null;
    try
    {
        conn = new DBClasses.GetConnection().getConnection();
        conn.createStatement().execute("UPDATE advertisement SET ActiveWHERE AdvertisementID=" + adID);
    }
    catch(Exception e) { e.printStackTrace(); response.sendRedirect("gohome.jsp"); }
    
    finally
    {
        try { conn.commit(); conn.close(); response.sendRedirect("gohome.jsp"); }
        catch(Exception e) {  response.sendRedirect("gohome.jsp"); }
    }
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>